home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS18.ADF / Progs / StarProbe / SPDRAW.BAS < prev    next >
BASIC Source File  |  1989-01-27  |  14KB  |  580 lines

  1. ' This program creates visual representations of the data from the StarProbe
  2. ' mathematical model. Its structure and organization have been borrowed from
  3. ' DeluxDraw (by Rich Wirch).
  4. '
  5. ' Allocate enough memory to save entire screen into an array
  6. DEF FNArraySize& = 3+INT((BobRight+16)/16)*(BobBottom+1)*Depth
  7.   BobRight = 600: BobBottom = 187 : Depth = 4
  8.   Size& = FNArraySize& * 2
  9.   IF FRE(0) AND FRE(-1) < Size& THEN PRINT "Not enough memory":END
  10.  
  11.   IF FRE(0) < Size& THEN 
  12.     CLEAR,Size&+24000
  13.     DEF FNArraySize& = 3+INT((BobRight+16)/16)*(BobBottom+1)*Depth
  14.   END IF
  15.   BobRight = 600: BobBottom = 187 : Depth = 4
  16.  
  17. DECLARE FUNCTION SetDrMd LIBRARY ' Set the Drawing Mode
  18. DECLARE FUNCTION Move LIBRARY    ' Move the Plotting Position
  19. DECLARE FUNCTION Flood LIBRARY   ' Flood Fill an Area
  20.  
  21. DEFINT a-z
  22. DIM SPdata!(1,8) 'Dummy decl; redone when loading data
  23. DIM SelData(8)
  24. DIM Dmin!(8),Dmax!(8),Dtitle$(8),Dcol(8)
  25. MaxVar=7
  26.  
  27. GOSUB Initialize
  28. GOSUB ReadData
  29.  
  30. '  Main loop - always return here or at next statement
  31. 'Main:
  32.  'WHILE l<>0: l = MOUSE(0): WEND
  33. Main2:
  34.  l = MOUSE(0):x = MOUSE(3):y = MOUSE(4)
  35.  y=y-1  'Fix Y to align better with pointer
  36.  Mbar = MENU(0)
  37.  IF Mbar > 0 THEN
  38.    Mitem = MENU(1)
  39.    IF Mbar = 1 THEN ' actions
  40.      ON Mitem GOSUB  ReadData, DataSummary, DrawGraph, Picture, ClearScreen,  Quit
  41.    ELSEIF Mbar = 2 THEN 'options
  42.      ON Mitem GOSUB PlotByMass, PlotByRadius, SmallPicts, LargePict, BaseSemiLog, BaseNormal
  43.    ELSEIF Mbar = 3 THEN 'data selection
  44.      GOSUB SelectData
  45.    END IF
  46.  END IF
  47.  
  48.  IF x<0 OR x>WWIDTH OR y<0 OR y>HEIGHT GOTO Main2
  49.  IF l <> 0 THEN GOSUB LeftButton
  50.  GOTO Main2   
  51.  
  52. LeftButton:
  53.   IF x < 220 OR x > 290 THEN RETURN
  54.   IF y > 80 THEN RETURN
  55.   Mitem = (y\10) + 1
  56.   IF Mitem > 8 THEN RETURN
  57.   GOSUB SelectData
  58.   RETURN
  59.  
  60.  ' ----------------- Subroutines -----------------
  61. '
  62. ClearScreen:
  63.   LINE (0,0)-(WWIDTH,HEIGHT),1,bf 'clear screen
  64.   RETURN
  65. '
  66. PlotByMass:
  67.   IndVar = 0
  68.   MENU 2,1,2
  69.   MENU 2,2,1
  70.   RETURN
  71. '
  72. PlotByRadius:
  73.   IndVar = 4
  74.   MENU 2,1,1
  75.   MENU 2,2,2
  76.   RETURN
  77. '
  78. SmallPicts:
  79.   PictSize=0
  80.   MENU 2,4,1
  81.   MENU 2,3,2
  82.   RETURN
  83. '
  84. LargePict:
  85.   PictSize=1
  86.   MENU 2,4,2
  87.   MENU 2,3,1
  88.   RETURN
  89. '
  90. BaseSemiLog:
  91.   IF SemiLog=0 THEN
  92.     GOSUB ConvertToLog   
  93.   END IF
  94.   GOSUB EvaluateRanges
  95.   MENU 2,5,2
  96.   MENU 2,6,1
  97.   SemiLog=1
  98.   RETURN
  99. '
  100. BaseNormal:
  101.   IF SemiLog=1 THEN
  102.     GOSUB ConvertToNormal
  103.   END IF
  104.   GOSUB EvaluateRanges
  105.   MENU 2,5,1
  106.   MENU 2,6,2
  107.   SemiLog=0
  108.   RETURN
  109. '
  110. DrawGraph:
  111.   GOSUB Outline
  112.   VarCount = 0
  113.   FOR i = 0 TO MaxVar
  114.     IF SelData(i) = 1 THEN
  115.       x = 10
  116.       IF SPdata!(0,i) > SPdata!(GradSteps,i) THEN y=0 ELSE y=180
  117.       DepVar = i
  118.       VarCount = VarCount + 1
  119.       COLOR Dcol(DepVar),1
  120.       GOSUB Description
  121.       GOSUB PlotIt
  122.     END IF
  123.   NEXT
  124.   GOSUB ResetDataMenu
  125.   FOR i = 0 TO MaxVar
  126.     SelData(i) = 0
  127.   NEXT
  128.   RETURN
  129. '
  130. Outline:
  131.   GOSUB ClearScreen
  132.   COLOR 3,1
  133.   LINE (10,1)-(10,180),3 'vert axis
  134.   LINE (10,180)-(410,180),3 'horiz axis
  135.   FOR x=10 TO 410 STEP 40
  136.     LINE (x,182)-(x,178),3'horiz hash marks
  137.   NEXT
  138.   CALL Move&(RP&, 430,180)
  139.   PRINT Dtitle$(IndVar);
  140.   RETURN
  141. '
  142. PlotIt:
  143.   OldX=x : OldY=y
  144.   IndScale!= (Dmax!(IndVar) - Dmin!(IndVar))/400!
  145.   DepScale!= (Dmax!(DepVar) - Dmin!(DepVar))/180!
  146.   FOR Ind = 0 TO GradSteps
  147.     x = 10 +  ((SPdata!(Ind,IndVar)-Dmin!(IndVar))/IndScale!)
  148.     y = 180 - ((SPdata!(Ind,DepVar)-Dmin!(DepVar))/DepScale!)
  149.     LINE (OldX,OldY)-(x,y)
  150.     OldX=x : OldY=y
  151.   NEXT
  152.   RETURN
  153. '
  154. Description:
  155.   z = 20 + (VarCount*10)
  156.   CALL Move&(RP&, 450, z)
  157.   PRINT Dtitle$(DepVar);
  158.   RETURN
  159. '
  160. PictDesc:
  161.   zy = 10 + ((VarCount\4)*110)
  162.   zx = 40 + ((VarCount MOD 4)*130)
  163.   CALL Move&(RP&, zx, zy)
  164.   PRINT Dtitle$(DepVar);
  165.   RETURN
  166. '
  167. Picture:
  168.   VarCount=0
  169.   GOSUB ClearScreen
  170.   FOR i = 2 TO 15' borrow most of the palette
  171.     PALETTE i,1!,i/15!,i/15! ' red based
  172.   NEXT
  173.   IF PictSize=1 THEN rmult = 4 ELSE rmult=1
  174.   done=0
  175.   FOR DepVar=0 TO MaxVar
  176.    IF SelData(DepVar)=1 THEN
  177.      IF done = 0 THEN GOSUB DoPict
  178.      IF PictSize=1 THEN done=1
  179.      VarCount=VarCount+1
  180.    END IF
  181.   NEXT
  182.   GOSUB WaitForMouse
  183.   SelData(DepVar)=0:GOSUB ResetDataMenu
  184.   GOSUB SetPalette
  185.   RETURN
  186. '
  187. DoPict:
  188.   IF PictSize=1 THEN
  189.     GOSUB Description
  190.   ELSE
  191.     GOSUB PictDesc
  192.   END IF
  193.   DepScale!= (Dmax!(DepVar) - Dmin!(DepVar))/13!
  194.   r=1
  195.   min!=Dmin!(DepVar)
  196.   IF PictSize=1 THEN
  197.     x0 = WWIDTH\2
  198.     y0 = HEIGHT\2
  199.   ELSE
  200.     x0 = 70 + ((VarCount MOD 4)*130)
  201.     y0 = 40 + ((VarCount\4)*110)
  202.   END IF
  203.   FOR j = 0 TO GradSteps
  204.     rnew=r+rmult
  205.     hue = 2 + (SPdata!(j,DepVar)-min!)/DepScale!    
  206.     FOR i = r TO rnew    
  207.       CIRCLE (x0,y0),i,hue
  208.     NEXT
  209.     r=rnew
  210.   NEXT
  211. RETURN
  212. '
  213. WaitForMouse:
  214.   l = MOUSE(0)
  215.   WHILE MOUSE(0)=0:WEND
  216.   RETURN
  217. '
  218. SelectData:
  219.   i=Mitem-1
  220.   ON Mitem GOSUB Smass,Spress,Stemp,Slum,Srad,Sdens,Sopcty,Senergy
  221.   IF SelData(i)=0 THEN SelData(i)=1 ELSE SelData(i)=0
  222.   RETURN  
  223. '
  224. Smass:
  225.   IF SelData(i) = 1 THEN
  226.     MENU 3,1,1
  227.   ELSE
  228.     MENU 3,1,2
  229.   END IF
  230.   RETURN
  231. Spress:
  232.   IF SelData(i) = 1 THEN
  233.     MENU 3,2,1
  234.   ELSE
  235.     MENU 3,2,2
  236.   END IF
  237.   RETURN
  238. Stemp:
  239.   IF SelData(i) = 1 THEN
  240.     MENU 3,3,1
  241.   ELSE
  242.     MENU 3,3,2
  243.   END IF
  244.   RETURN
  245. Slum:
  246.   IF SelData(i) = 1 THEN
  247.     MENU 3,4,1
  248.   ELSE
  249.     MENU 3,4,2
  250.   END IF
  251.   RETURN
  252. Srad:
  253.   IF SelData(i) = 1 THEN
  254.     MENU 3,5,1
  255.   ELSE
  256.     MENU 3,5,2
  257.   END IF
  258.   RETURN
  259. Sdens:
  260.   IF SelData(i) = 1 THEN
  261.     MENU 3,6,1
  262.   ELSE
  263.     MENU 3,6,2
  264.   END IF
  265.   RETURN
  266. Sopcty:
  267.   IF SelData(i) = 1 THEN
  268.     MENU 3,7,1
  269.   ELSE
  270.     MENU 3,7,2
  271.   END IF
  272.   RETURN
  273. Senergy:
  274.   IF SelData(i) = 1 THEN
  275.     MENU 3,8,1
  276.   ELSE
  277.     MENU 3,8,2
  278.   END IF
  279.   RETURN
  280.  
  281. ReadData:
  282.   PENDING=4: CANCEL=FALSE: GOSUB GetName ' get a filename
  283.   IF FileName$<>"" AND (NOT CANCEL) THEN 
  284.     OPEN FileName$ FOR INPUT AS 1 LEN=1024
  285.   ELSE
  286.     PENDING = 0
  287.     RETURN
  288.   END IF
  289.   FOR i = 0 TO MaxVar
  290.     Dmin!(i) = 3E+38
  291.     Dmax!(i) =-1!
  292.   NEXT
  293.   INPUT #1,steps
  294.   ERASE SPdata!
  295.   DIM SPdata!(steps,8)
  296.   GradSteps = steps - 1
  297.   FOR i = 0 TO GradSteps
  298.     FOR j = 0 TO MaxVar
  299.       INPUT #1,SPdata!(i,j)
  300.     NEXT
  301.   NEXT
  302.   CLOSE #1
  303.   SemiLog=-1 ' bypass conversion
  304.   GOSUB BaseNormal
  305.   PENDING = 0
  306.   RETURN
  307. '
  308. EvaluateRanges:
  309.   FOR i = 0 TO GradSteps
  310.     FOR j = 0 TO MaxVar
  311.       IF SPdata!(i,j) > Dmax!(j) THEN Dmax!(j) = SPdata!(i,j)
  312.       IF SPdata!(i,j) < Dmin!(j) THEN Dmin!(j) = SPdata!(i,j)
  313.     NEXT               
  314.   NEXT
  315.   GOSUB DataSummary
  316.   RETURN
  317. '
  318. ConvertToLog:
  319.   cv! = .4343
  320.   FOR i = 0 TO GradSteps
  321.     FOR j = 0 TO MaxVar
  322.       SPdata!(i,j) = cv!*LOG(SPdata!(i,j))
  323.     NEXT
  324.   NEXT
  325.   RETURN
  326. '
  327. ConvertToNormal:
  328.   cv! = .4343
  329.   FOR i = 0 TO GradSteps
  330.     FOR j = 0 TO MaxVar
  331.       SPdata!(i,j) = EXP((SPdata!(i,j)/cv!))
  332.     NEXT
  333.   NEXT
  334.   RETURN
  335. '
  336. DataSummary:
  337.   GOSUB ClearScreen
  338.   COLOR 3,1
  339.   CALL Move&(RP&, 150,20): PRINT "Data";
  340.   CALL Move&(RP&, 260,20): PRINT "Minimum";
  341.   CALL Move&(RP&, 380,20): PRINT "Maximum";
  342.   FOR DepVar = 0 TO MaxVar
  343.     COLOR Dcol(DepVar),1
  344.     y = 40 + (DepVar*10)
  345.     CALL Move&(RP&, 150,y):  PRINT Dtitle$(DepVar);
  346.     CALL Move&(RP&, 250,y):  PRINT Dmin!(DepVar);
  347.     CALL Move&(RP&, 370,y):  PRINT Dmax!(DepVar);
  348.   NEXT
  349.   RETURN
  350.  
  351. '  File name requestor routine.  We'll be looking for mouse
  352. '  clicks as well as character input, so use GET versus INPUT
  353. '  to receive the file name. 
  354. '
  355. GetName:
  356.   BobRight = 190: BobBottom = 80
  357.   Size&=FNArraySize& \2
  358.   DIM SavReq&(Size&)
  359.   GET( 50,16)-(240,96), SavReq&
  360.   i= 40  'Pop out the requestor box
  361.     LINE(90-i,56-i)-(200+i,56+i),2,bf
  362.   LINE(50,16)-(240,96),3,b
  363.   COLOR 1,2:CALL Move&(RP&,53,35): PRINT Prompt$;
  364.   LINE(85,50)-(202,62),3,b
  365.   '  This little box is the "cursor", in yellow
  366.   CURS=88: LINE(CURS,52)-(CURS+7,60),3,bf
  367.   LINE(166,74)-(219,86),3,b
  368.   COLOR 3,1: CALL Move&(RP&, 169,83): PRINT "Cancel";
  369.   CALL Move&(RP&, 60,40): PRINT "Enter data file name";
  370.   
  371.   '  Allowable file names (change it to suit your taste):
  372.   '     First character must be a letter
  373.   '     Remaining chars may be letters, numbers or . or -
  374.   '     Maximum of 13 chars 
  375.   '     No two . or - may be adjoining
  376.   '     No embedded blanks allowed
  377.   '
  378.   C$=INKEY$: WHILE C$<>"": C$=INKEY$: WEND   'Clear any queued input
  379.   FileName$=""
  380.  
  381. Loop:
  382.  C$=INKEY$: l=MOUSE(0): x=MOUSE(1):y=MOUSE(2)
  383.  IF l<>0 THEN
  384.    WHILE l<>0: l=MOUSE(0): x=MOUSE(1):y=MOUSE(2): WEND  'Wait for button release
  385.    '  See if we're in the CANCEL box
  386.    y=y-1  'For better pointer alignment
  387.    IF x>165 AND x<220 AND y>73 AND y<87 THEN 
  388.      CANCEL=TRUE: PUT(50,16),SavReq&,PSET: ERASE SavReq&: RETURN
  389.    END IF
  390.  END IF
  391.  IF C$="" THEN GOTO Loop
  392.  'LINE(75,69)-(183,91),2,b
  393.  IF LEN(FileName$)=0 THEN IF C$<"A" AND ASC(C$)<>13 GOTO Loop  'This must be the first character
  394.  IF ASC(C$) = 13 THEN   '13=Carriage return
  395.    PUT( 50,16),SavReq&,PSET: ERASE SavReq&
  396.    RETURN
  397.  END IF
  398.  IF ASC(C$) = 8 THEN   '8=Backspace
  399.     FileName$=LEFT$(FileName$,LEN(FileName$)-1)  'Shorten name
  400.     LINE(CURS,52)-(CURS+7,60),2,bf  'Back up cursor
  401.     CURS=CURS-8: LINE(CURS,52)-(CURS+7,60),3,bf
  402.     GOTO Loop
  403.  END IF
  404.  IF LEN(FileName$) >= 13 GOTO Loop  'No more letters
  405.  IF RIGHT$(FileName$,1)="." OR RIGHT$(FileName$,1)="-" GOTO Loop
  406.  IF ASC(C$)=8 THEN GOTO Loop   'Superfluous backspace
  407.  IF C$<"0" OR (C$>"9" AND C$<"A") GOTO Loop
  408.  IF (C$>"Z" AND C$<"a") OR C$>"z" GOTO Loop
  409.  '  Add this letter and advance cursor
  410.  FileName$= FileName$ + C$
  411.  LINE(CURS,52)-(CURS+7,60),2,bf
  412.  COLOR 1,2: CALL Move&(RP&,0,59): PRINT PTAB(CURS);C$;
  413.  CURS=CURS+8: LINE(CURS,52)-(CURS+7,60),3,bf
  414.  GOTO Loop  'Get another character
  415.  
  416. InitFile:
  417.   FileName$=""
  418.   BobRight=  WWIDTH-1
  419.   BobBottom= HEIGHT-1
  420.   PlanePick= MaxColor
  421.   RETURN 
  422.  
  423. '
  424. Quit:
  425.    LIBRARY CLOSE
  426.    WINDOW CLOSE 2
  427.    SCREEN CLOSE 1
  428.    MENU RESET
  429.    END 
  430.  
  431. '--------------------------------------------------
  432. Initialize:
  433.  
  434.   Depth = 4 'Depth =0
  435.  'WHILE Depth < 2 or Depth > 5
  436.  '   INPUT "Select number of bit planes (2-5) ",Depth
  437.  'WEND
  438.  
  439.   RES=631  'RES=0
  440.   IF Depth = 5 THEN
  441.     RES = 311
  442.   ELSE
  443.     WHILE RES=0
  444.       INPUT "Select resolution (Hi/Lo) ", C$
  445.       C$=LEFT$(C$,1)
  446.       IF C$="H" OR C$="h" THEN RES=631
  447.       IF C$="L" OR C$="l" THEN RES=311
  448.     WEND
  449.   END IF
  450.  
  451.   DIM PAT1%(1),PAT2%(1),PCan!(31,3) : DIM BobArray(1)
  452.  
  453.   RES2=RES/320   'For hi-res aspect ratio for circles
  454.   IF RES < 400 THEN scrmode = 1 ELSE scrmode = 2  
  455.   SCREEN 1, scrmode*320, 200, Depth, scrmode
  456.   CLS
  457.   WINDOW 2,"StarProbe Analyzer",(0,0)-(RES,186),0,1
  458.   WINDOW OUTPUT 2
  459.  
  460.   TRUE=-1: FALSE=0   'For convenience
  461.   IF Depth = 5 THEN COLBOX = 6 ELSE COLBOX = 10
  462.   '  Set colors for Paintbox
  463.   PCan!(0,0)= 6/15: PCan!(0,1)= 6/15: PCan!(0,2)= 6/15   'Dark grey
  464.   PCan!(1,0)= 0/15: PCan!(1,1)= 0/15: PCan!(1,2)= 0/15   'Black
  465.   PCan!(2,0)=10/15: PCan!(2,1)=10/15: PCan!(2,2)=10/15   'Light grey
  466.   PCan!(3,0)=15/15: PCan!(3,1)=15/15: PCan!(3,2)=15/15   'White
  467.   PCan!(4,0)=15/15: PCan!(4,1)= 9/15: PCan!(4,2)= 9/15   'Pink
  468.   PCan!(5,0)=15/15: PCan!(5,1)= 6/15: PCan!(5,2)= 6/15   'Light Red
  469.   PCan!(6,0)=15/15: PCan!(6,1)= 2/15: PCan!(6,2)= 2/15   'Red
  470.   PCan!(7,0)=12/15: PCan!(7,1)= 0/15: PCan!(7,2)= 14/15  'Purple
  471.   PCan!(8,0)= 7/15: PCan!(8,1)=13/15: PCan!(8,2)= 15/15  'Light Blue
  472.   PCan!(9,0)= 8/15: PCan!(9,1)= 8/15: PCan!(9,2)= 15/15  'Med.  Blue
  473.   PCan!(10,0)= 4/15:PCan!(10,1)= 4/15:PCan!(10,2)=15/15  'Dark  Blue
  474.   PCan!(11,0)= 0/15:PCan!(11,1)=14/15:PCan!(11,2)= 13/15 'Aqua
  475.   PCan!(12,0)= 8/15:PCan!(12,1)=12/15:PCan!(12,2)= 8/15  'Light Green
  476.   PCan!(13,0)= 4/15:PCan!(13,1)=12/15:PCan!(13,2)= 4/15  'Med.  Green
  477.   PCan!(14,0)= 0/15:PCan!(14,1)=15/15:PCan!(14,2)= 0/15  'Dark  Green
  478.   PCan!(15,0)=15/15:PCan!(15,1)=15/15:PCan!(15,2)= 2/15  'Yellow
  479.  
  480.   PCan!(16,0)=0/15: PCan!(16,1)= 4/15: PCan!(16,2)= 4/15   'aquas
  481.   PCan!(17,0)=0/15: PCan!(17,1)= 6/15: PCan!(17,2)= 6/15  
  482.   PCan!(18,0)=0/15: PCan!(18,1)= 8/15: PCan!(18,2)= 8/15   
  483.   PCan!(19,0)=0/15: PCan!(19,1)=10/15: PCan!(19,2)= 10/15  
  484.   PCan!(20,0)=0/15: PCan!(20,1)=12/15: PCan!(20,2)= 12/15  
  485.  
  486.   PCan!(21,0)=15/15: PCan!(21,1)=15/15: PCan!(21,2)= 2/15   'yellows
  487.   PCan!(22,0)=15/15: PCan!(22,1)=15/15: PCan!(22,2)= 4/15  
  488.   PCan!(23,0)=15/15: PCan!(23,1)=15/15: PCan!(23,2)= 6/15  
  489.   PCan!(24,0)=15/15: PCan!(24,1)=15/15: PCan!(24,2)= 8/15 
  490.   PCan!(25,0)=15/15: PCan!(25,1)=15/15: PCan!(25,2)= 10/15  
  491.   PCan!(26,0)=15/15: PCan!(26,1)=15/15: PCan!(26,2)= 12/15
  492.  
  493.   PCan!(27,0)= 2/15: PCan!(27,1)= 15/15:PCan!(27,2)= 2/15   'greens
  494.   PCan!(28,0)= 4/15: PCan!(28,1)= 15/15:PCan!(28,2)= 4/15
  495.   PCan!(29,0)= 6/15: PCan!(29,1)= 15/15:PCan!(29,2)= 6/15
  496.   PCan!(30,0)= 8/15: PCan!(30,1)= 15/15:PCan!(30,2)= 8/15 
  497.   PCan!(31,0)= 10/15:PCan!(31,1)= 15/15:PCan!(31,2)= 10/15 
  498.  
  499.   GOSUB SetPalette
  500.  
  501.   LIBRARY "graphics.library"
  502.   RP& = WINDOW(8)               ' Pointer to the Raster Port
  503.   W=WINDOW( 2): H=WINDOW(3): WWIDTH=W: HEIGHT=H
  504.  
  505.   '  Menu items
  506.   MENU 1,0,1,"AstroProject"
  507.   MENU 1,1,1,"Read Data   "
  508.   MENU 1,2,1,"Data Summary"
  509.   MENU 1,3,1,"Draw Graphs "
  510.   MENU 1,4,1,"Picture     "
  511.   MENU 1,5,1,"Clear Screen"
  512.   MENU 1,6,1,"Quit        "
  513.  
  514.   MENU 2,0,1,"Options"
  515.   MENU 2,1,1,"   Plot By Mass  "
  516.   MENU 2,2,1,"   Plot By Radius"
  517.   MENU 2,3,1,"   Small Pictures"
  518.   MENU 2,4,1,"   Large Picture "
  519.   MENU 2,5,1,"   Semi-Log Base "
  520.   MENU 2,6,1,"   Regular Base  "
  521.  
  522.   MENU 3,0,1,"Select Data"
  523.   GOSUB SetDataMenu
  524.  
  525.   MENU 4,0,0,""  ' not used, overlays the fourth menu in amigabasic
  526.  
  527. '   Set default options
  528.   GOSUB PlotByRadius
  529.   GOSUB SmallPicts
  530.  
  531.   Dtitle$(0) = "Mass"
  532.   Dtitle$(1) = "Pressure"
  533.   Dtitle$(2) = "Temperature"
  534.   Dtitle$(3) = "Luminosity"
  535.   Dtitle$(4) = "Radius"
  536.   Dtitle$(5) = "Density"
  537.   Dtitle$(6) = "Opacity"
  538.   Dtitle$(7) = "EnergyRate"
  539.  
  540.   Dcol(0)=3 : Dcol(1)=7 : Dcol(2)=6 : Dcol(3)=11
  541.   Dcol(4)=10: Dcol(5)=0 : Dcol(6)=2 : Dcol(7)=15
  542.  
  543.  '  Initialize starting values
  544.  TextX = 47: TextY = 8
  545.  COL = 1 : LASTCOLOR = 0 : MaxColor = 2^Depth - 1     ' Color info
  546.  Style = 2: DY = Style - 1: DX = 2 * DY * RES2        ' Style info
  547.  SelMass=0:SelPress=0:SelTemp=0:SelLum=0:SelRad=0:SelDens=0
  548.  SelOpcty=0:SelEnergy=0
  549.  PI!=3.14159
  550.  GOSUB InitFile
  551.  
  552.  l = MOUSE(0): x = MOUSE(1): y = MOUSE(2):
  553.  RETURN
  554. '
  555. SetDataMenu:
  556.   MENU 3,1,1,"   Mass   "
  557.   MENU 3,2,1,"   Press  "
  558.   MENU 3,3,1,"   Temp   "
  559.   MENU 3,4,1,"   Lum    "
  560.   MENU 3,5,1,"   Radius "
  561.   MENU 3,6,1,"   Density"
  562.   MENU 3,7,1,"   Opacity"
  563.   MENU 3,8,1,"   Energy "
  564.   RETURN
  565. ResetDataMenu:
  566.   MENU 3,1,1
  567.   MENU 3,2,1
  568.   MENU 3,3,1
  569.   MENU 3,4,1
  570.   MENU 3,5,1
  571.   MENU 3,6,1
  572.   MENU 3,7,1
  573.   MENU 3,8,1
  574.   RETURN
  575. '
  576. SetPalette:
  577.   FOR i=0 TO 2^Depth-1: PALETTE i, PCan!( i,0), PCan!( i,1), PCan!( i,2): NEXT
  578.   RETURN
  579.  
  580.